package com.wry.wry_test.algorithm;

/**
 * @Author: wangrongyi
 * @Date: 2024/11/19 14:00
 * @Description:
 */
public class Day11 {

    public static String solution(String s, int k) {
        // write code here

        for (int i = 0; i < k; i++) {

            char[] chars = s.toCharArray();
            StringBuilder sb = new StringBuilder();
            for (char c : chars) {
                switch (c) {
                    case 'a':
                        sb.append("bc");
                        break;
                    case 'b':
                        sb.append("ca");
                        break;
                    case 'c':
                        sb.append("ab");
                        break;
                }
            }
            s = sb.toString();
        }
        return s;
    }

    public static void main(String[] args) {
        System.out.println(solution("abc", 2).equals("caababbcbcca"));
        System.out.println(solution("abca", 3).equals("abbcbccabccacaabcaababbcabbcbcca"));
        System.out.println(solution("cba", 1).equals("abcabc"));
    }

}
